<?php
/**
 * Created by PhpStorm.
 * User: 10838
 * Date: 2017/11/10
 * Time: 14:32
 */
namespace code;
class Code
{
    //短信接口用户名 $uid
    //public $uid = 'LKSDK0005615';
    public $uid = 'CDJS004711';
    //短信接口密码 $passwd
   // public $passwd = 'mjssj@1998';
    public $passwd = 'youj@711';
    //发送到的目标手机号码 $telphone
    public $telphone = '';
    //短信内容 $message
    public $message = "";

    //$action=isset($_POST['action'])?$_POST['action']:'';
    public function send($code_num){
        $message = rawurlencode(mb_convert_encoding("您的验证码为:".$code_num, "gb2312", "utf-8"));
        //$gateway = "https://mb345.com/ws/batchSend2.aspx?CorpID={$this->uid}&Pwd={$this->passwd}&Mobile={$this->telphone}&Content={$message}&Cell=&SendTime=";
        $gateway = "http://sdk2.028lk.com:9880/sdk2/batchSend2.aspx?CorpID={$this->uid}&Pwd={$this->passwd}&Mobile={$this->telphone}&Content={$message}&Cell=&SendTime=";

        $result = file_get_contents($gateway);

       if(  $result >0 )
        {
           return true;
        }
        else
        {
            return false;
            //echo "发送失败, 错误提示代码: ".$result;
        }

    }

    }